﻿<navigation:Page x:Class="DC_RackSLDE.vwtblProductData" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 
           xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
           xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
           xmlns:dataFormToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit" 
           xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
           xmlns:domain="clr-namespace:DC_RackSLDE"
         
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Product Attributes">

    <Grid x:Name="LayoutRoot">


        <!-- Get the data definitions up front -->
        <!-- Edit Query Name -->
        <!-- defined over in the DomainService (RIA implementation) on the web side -->
        <!-- **************************** -->
        <riaControls:DomainDataSource x:Name="dds"             
                                              AutoLoad="True"            
                                              QueryName="GetTblProductDatas"   
                                              LoadSize="20"
                                              LoadingData="dds_LoadingData"
                                              SubmittedChanges="dds_SubmittedChanges"
                                              >

            <riaControls:DomainDataSource.DomainContext>
                <domain:tblProductData_DCRackDomainContext/>
            </riaControls:DomainDataSource.DomainContext>

            <!-- edit field name for group descriptor -->
            <!-- **************************** -->
            <riaControls:DomainDataSource.GroupDescriptors>
                <riaControls:GroupDescriptor PropertyPath="prodVendor" />
            </riaControls:DomainDataSource.GroupDescriptors>

            <!-- edit propertypath name for filter descriptor -->
            <!-- **************************** -->
            <riaControls:DomainDataSource.FilterDescriptors>
                <riaControls:FilterDescriptor PropertyPath="prodVendor"
                                               Operator="StartsWith" Value="{Binding ElementName=tableFilterBox, Path=Text}" />
            </riaControls:DomainDataSource.FilterDescriptors>
        </riaControls:DomainDataSource>

        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" Margin="0,0,0,-33">

            <!-- Busy Indicator -->
            <controlsToolkit:BusyIndicator 
            IsBusy="{Binding ElementName=dds, Path=IsBusy}"   
            >

                <!-- Content stack panel -->
                <!-- Comment start and stop of all of the stack panels -->
                <StackPanel x:Name="ContentStackPanel" 
                        Height="480" Width="640">

                    <!-- datacontrols panel -->
                    <StackPanel x:Name="spDataControls" 
                            Width="638" Height="440" 
                            Orientation="Horizontal">

                        <StackPanel x:Name="spDataGrid" Orientation="Vertical" Height="410" Width="311">
                            <!-- filterbox stack panel -->
                            <StackPanel x:Name="spFilterBox" Height="30" Width="311" Orientation="Horizontal" Margin="0,0,0,10">
                                <!-- change textblock to match filter descriptor -->
                                <!-- **************************** -->
                                <TextBlock Text=" Filter prodVendor  " Height="28" Width="125" FontSize="12" />
                                <input:AutoCompleteBox x:Name="tableFilterBox" Width="180" Height="28" ValueMemberBinding="{Binding Name}" Margin="0,1" />
                                <!-- end filterbox stack panel -->
                            </StackPanel>

                            <dataControls:DataGrid x:Name="_dataGrid" Height="335" Width="310" AutoGenerateColumns="False" 
                                       ItemsSource="{Binding Data, ElementName=dds}" VerticalScrollBarVisibility="Auto" 
                                       AlternatingRowBackground="Beige" Margin="0" SelectionChanged="_dataGrid_SelectionChanged">

                                <!-- Load datagrid columns here, recommend Karl Shifflett Xaml toys -->
                                <!-- **************************** -->

                                <dataControls:DataGrid.Columns>
                                    <dataControls:DataGridTextColumn Header=" Key" Binding="{Binding prodKey}" SortMemberPath="prodKey" />

                                    <dataControls:DataGridTextColumn Header=" Vendor" Binding="{Binding prodVendor}" SortMemberPath="prodVendor" />

                                    <dataControls:DataGridTextColumn Header=" Product" Binding="{Binding prodProduct}" SortMemberPath="prodProduct" />

                                    <dataControls:DataGridTextColumn Header=" Model" Binding="{Binding prodModel}" SortMemberPath="prodModel" />

                                    <dataControls:DataGridTextColumn Header=" Part Nr" Binding="{Binding prodPartNr}" SortMemberPath="prodPartNr" />

                                    <dataControls:DataGridTextColumn Header=" Slots" Binding="{Binding prodSlots}" SortMemberPath="prodSlots" />

                                    <dataControls:DataGridTextColumn Header=" Master Top" Binding="{Binding prodMasterTop}" SortMemberPath="prodMasterTop" />

                                    <dataControls:DataGridTextColumn Header=" Master Rear" Binding="{Binding prodMasterRear}" SortMemberPath="prodMasterRear" />

                                    <dataControls:DataGridTextColumn Header=" Master Front" Binding="{Binding prodMasterFront}" SortMemberPath="prodMasterFront" />

                                    <dataControls:DataGridTextColumn Header=" Master Logical" Binding="{Binding prodMasterLogical}" SortMemberPath="prodMasterLogical" />

                                    <dataControls:DataGridTextColumn Header=" Stencil" Binding="{Binding prodStencil}" SortMemberPath="prodStencil" />

                                    <dataControls:DataGridTextColumn Header=" Type" Binding="{Binding prodType}" SortMemberPath="prodType" />

                                    <dataControls:DataGridTextColumn Header=" Sub Type" Binding="{Binding prodSubType}" SortMemberPath="prodSubType" />

                                    <dataControls:DataGridCheckBoxColumn Header=" Error Slot" Binding="{Binding prodErrorSlot}" SortMemberPath="prodErrorSlot" />
                                    <dataControls:DataGridCheckBoxColumn Header=" Error Port" Binding="{Binding prodErrorPort}" SortMemberPath="prodErrorPort" />
                                    <dataControls:DataGridCheckBoxColumn Header=" Error General" Binding="{Binding prodErrorGeneral}" SortMemberPath="prodErrorGeneral" />
                                    <dataControls:DataGridTextColumn Header=" B T U" Binding="{Binding prodBTU}" SortMemberPath="prodBTU" />

                                    <dataControls:DataGridTextColumn Header=" Weight" Binding="{Binding prodWeight}" SortMemberPath="prodWeight" />

                                    <dataControls:DataGridTextColumn Header=" Power" Binding="{Binding prodPower}" SortMemberPath="prodPower" />

                                    <dataControls:DataGridTextColumn Header=" Voltage" Binding="{Binding prodVoltage}" SortMemberPath="prodVoltage" />

                                    <dataControls:DataGridTextColumn Header=" Comments" Binding="{Binding prodComments}" SortMemberPath="prodComments" />

                                    <dataControls:DataGridTextColumn Header=" Last Edit" Binding="{Binding prodLastEdit}" SortMemberPath="prodLastEdit" />

                                    <dataControls:DataGridTextColumn Header=" Last Update" Binding="{Binding prodLastUpdate}" SortMemberPath="prodLastUpdate" />

                                </dataControls:DataGrid.Columns>


                                <!-- **************************** -->
                                <!-- End of datagrid column specifications -->
                            </dataControls:DataGrid>
                            <dataControls:DataPager Source="{Binding Data, ElementName=dds}" PageSize="10" />

                            <!-- end datagrid stack panel-->
                        </StackPanel>

                        <StackPanel x:Name="spDataForm" Height="410" Width="319">
                            <!-- Change Data Header Name here -->
                            <!-- **************************** -->
                            <TextBlock Text="Product Details" Height="28" FontSize="12" FontWeight="Normal" />

                            <dataFormToolkit:DataForm x:Name="_dataForm" Height="371" Width="319" VerticalAlignment="Top" 
                               CommandButtonsVisibility="Commit,Cancel,Edit" AutoEdit="False" AutoCommit="False" CommitButtonContent="Commit" 
                               CancelButtonContent="Cancel" CurrentItem="{Binding SelectedItem, ElementName=_dataGrid}" 
                               HorizontalAlignment="Left" Margin="0,0,0,0" AutoGenerateFields="False">
                                <!-- Load dataform columns and templates here -->
                                <!-- **************************** -->



                                <dataFormToolkit:DataForm.EditTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>

                                            <dataFormToolkit:DataField Grid.Row="0" Grid.Column="0" Label=" Key" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodKey, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="1" Grid.Column="0" Label=" Vendor" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodVendor, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="2" Grid.Column="0" Label=" Product" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodProduct, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="3" Grid.Column="0" Label=" Model" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodModel, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="4" Grid.Column="0" Label=" Part Nr" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodPartNr, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="5" Grid.Column="0" Description="optional" DescriptionViewerPosition="Auto" Label=" Slots" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodSlots, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="6" Grid.Column="0" Description="visio master used for top view " DescriptionViewerPosition="Auto" Label=" Master Top" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodMasterTop, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="7" Grid.Column="0" Description="visio master used for rear view" DescriptionViewerPosition="Auto" Label=" Master Rear" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodMasterRear, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="8" Grid.Column="0" Description="visio master used for front view" DescriptionViewerPosition="Auto" Label=" Master Front" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodMasterFront, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="9" Grid.Column="0" Description="visio master used for generic view" DescriptionViewerPosition="Auto" Label=" Master Logical" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodMasterLogical, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="10" Grid.Column="0" Description="visio stencil associated with the master shapes" DescriptionViewerPosition="Auto" Label=" Stencil" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodStencil, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="11" Grid.Column="0" Description="product table data definition" DescriptionViewerPosition="Auto" Label=" Type" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodType, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="12" Grid.Column="0" Description="product table data defintion" DescriptionViewerPosition="Auto" Label=" Sub Type" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodSubType, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="13" Grid.Column="0" Description="used in table validation" DescriptionViewerPosition="Auto" Label=" Error Slot" LabelPosition="Auto">
                                                <CheckBox Content="" IsChecked="{Binding Path=prodErrorSlot, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="14" Grid.Column="0" Description="used in table validation" DescriptionViewerPosition="Auto" Label=" Error Port" LabelPosition="Auto">
                                                <CheckBox Content="" IsChecked="{Binding Path=prodErrorPort, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="15" Grid.Column="0" Description="used in table validation" DescriptionViewerPosition="Auto" Label=" Error General" LabelPosition="Auto">
                                                <CheckBox Content="" IsChecked="{Binding Path=prodErrorGeneral, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="16" Grid.Column="0" Label=" B T U" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodBTU, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="17" Grid.Column="0" Label=" Weight" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodWeight, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="18" Grid.Column="0" Label=" Power" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodPower, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="19" Grid.Column="0" Label=" Voltage" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodVoltage, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="20" Grid.Column="0" Label=" Comments" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodComments, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="21" Grid.Column="0" Label=" Last Edit" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodLastEdit, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                            <dataFormToolkit:DataField Grid.Row="22" Grid.Column="0" Label=" Last Update" LabelPosition="Auto">
                                                <TextBox Text="{Binding Path=prodLastUpdate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=\{0:d\}}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
                                            </dataFormToolkit:DataField>

                                        </Grid>
                                    </DataTemplate>
                                </dataFormToolkit:DataForm.EditTemplate>



                                <!-- **************************** -->
                                <!-- end of dataform columns and templates -->
                            </dataFormToolkit:DataForm>
                            <!-- end data form stack panel -->
                        </StackPanel>
                        <!-- end details stack panel -->
                    </StackPanel>
                    <StackPanel x:Name="spActionButtons" Height="30" Orientation="Horizontal" Width="268" HorizontalAlignment="Left">
                        <Button Click="btnSubmit_Click" Content="Submit" Height="28" Name="btnSubmit" Width="65" />
                        <Button Click="btnExport_Click" Content="Export" Height="28" HorizontalAlignment="Left" Margin="0" Name="btnExport" Width="65" />
                        <Button Click="btnCreate_Click" Content="Create" Height="28" Name="btnCreate" Width="65" />
                        <Button Click="btnDelete_Click" Content="Delete" Height="28" HorizontalAlignment="Left" Margin="0" Name="btnDelete" Width="65" />
                        <!-- end action buttons panel-->
                    </StackPanel>


                    <!-- End Content Stack Panel -->
                </StackPanel>

            </controlsToolkit:BusyIndicator>
            
        </ScrollViewer>

        <!-- end layout root -->
    </Grid>

</navigation:Page>

